[IA64] Fix serial console on Tiger2 & Tiger4
authorawilliam@xenbuild2.aw <awilliam@xenbuild2.aw>
Wed, 14 Feb 2007 17:14:37 +0000 (10:14 -0700)
committerawilliam@xenbuild2.aw <awilliam@xenbuild2.aw>
Wed, 14 Feb 2007 17:14:37 +0000 (10:14 -0700)
I inadvertently broke the serial console on Intel Tiger systems by
assuming they were registering a com1 at 0x3f8.  Instead, unconditionally
register both com ports (the ns16550 driver will throw away any that
don't have baud == 0) and create a function to detect the Tiger systems.
This should setup reasonable default com port values, but they can still
be superceded using com1= and com2= boot time parameters.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
xen/arch/ia64/linux-xen/setup.c
xen/arch/ia64/xen/pcdp.c
xen/arch/ia64/xen/xensetup.c

index c7744eddd45a21d3f098ac468825aaf6fcb92600..b82e9a7b239654f6df42f94b0a194a91cd863571 100644 (file)
@@ -314,6 +314,74 @@ io_port_init (void)
        num_io_spaces = 1;
 }
 
+#ifdef XEN
+static int __init
+intel_tiger_console_setup(void)
+{
+       extern struct ns16550_defaults ns16550_com1, ns16550_com2;
+       efi_system_table_t *systab;
+       efi_config_table_t *tables;
+       struct acpi20_table_rsdp *rsdp = NULL;
+       struct acpi_table_xsdt *xsdt;
+       struct acpi_table_header *hdr;
+       int i;
+
+       /* Don't duplicate setup if an HCDP table is present */
+       if (efi.hcdp)
+               return -ENODEV;
+
+       /* Manually walk firmware provided tables to get to the XSDT.  */
+       systab = __va(ia64_boot_param->efi_systab);
+
+       if (!systab || systab->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE)
+               return -ENODEV;
+
+       tables = __va(systab->tables);
+
+       for (i = 0 ; i < (int)systab->nr_tables && !rsdp ; i++) {
+               if (efi_guidcmp(tables[i].guid, ACPI_20_TABLE_GUID) == 0)
+                       rsdp =
+                            (struct acpi20_table_rsdp *)__va(tables[i].table);
+       }
+
+       if (!rsdp || strncmp(rsdp->signature, RSDP_SIG, sizeof(RSDP_SIG) - 1))
+               return -ENODEV;
+
+       xsdt = (struct acpi_table_xsdt *)__va(rsdp->xsdt_address);
+       hdr = &xsdt->header;
+
+       if (strncmp(hdr->signature, XSDT_SIG, sizeof(XSDT_SIG) - 1))
+               return -ENODEV;
+
+       /* Only looking for Intel systems */
+       if (strncmp(hdr->oem_id, "INTEL", 5))
+               return -ENODEV;
+
+       if (!strncmp(hdr->oem_table_id, "SR870BH2", 8)) {
+               /* Tiger 2 */
+               ns16550_com1.baud = BAUD_AUTO;
+               ns16550_com1.io_base = 0x3f8;
+               ns16550_com1.irq = 4;
+
+               ns16550_com2.baud = BAUD_AUTO;
+               ns16550_com2.io_base = 0x2f8;
+               ns16550_com2.irq = 3;
+
+               return 0;
+
+       } else if (!strncmp(hdr->oem_table_id, "SR870BN4", 8)) {
+               /* Tiger 4 */
+               ns16550_com1.baud = BAUD_AUTO;
+               ns16550_com1.io_base = 0x2f8;
+               ns16550_com1.irq = 3;
+               
+               return 0;
+       }
+
+       return -ENODEV;
+}
+#endif
+
 /**
  * early_console_setup - setup debugging console
  *
@@ -344,6 +412,10 @@ early_console_setup (char *cmdline)
                earlycons++;
 #endif
 
+#ifdef XEN
+       if (!intel_tiger_console_setup())
+               earlycons++;
+#endif
        return (earlycons) ? 0 : -1;
 }
 
index 4f968cd33011a4cd3e1feacd5351526385a7eedf..d519c0770860fe17d65a63d958c93d28ffa5de31 100644 (file)
@@ -140,7 +140,7 @@ static int __init
 setup_serial_console(struct pcdp *pcdp, struct pcdp_uart *uart)
 {
 
-       ns16550_com1.baud = uart->baud;
+       ns16550_com1.baud = uart->baud ? uart->baud : BAUD_AUTO;
        ns16550_com1.io_base = uart->addr.address;
        if (uart->bits)
                ns16550_com1.data_bits = uart->bits;
index 8909136b26e351b2fb6ce9b2af9442e7fa4b73be..c76922123087826ea3895c67c581f0e1477f311c 100644 (file)
@@ -147,7 +147,6 @@ void early_cmdline_parse(char **cmdline_p)
 }
 
 struct ns16550_defaults ns16550_com1 = {
-    .baud      = BAUD_AUTO,
     .data_bits = 8,
     .parity    = 'n',
     .stop_bits = 1
@@ -158,7 +157,6 @@ unsigned int ns16550_com1_polarity;
 unsigned int ns16550_com1_trigger;
 
 struct ns16550_defaults ns16550_com2 = {
-    .baud      = BAUD_AUTO,
     .data_bits = 8,
     .parity    = 'n',
     .stop_bits = 1
@@ -271,12 +269,7 @@ void start_kernel(void)
         hpsim_serial_init();
     else {
         ns16550_init(0, &ns16550_com1);
-        if (ns16550_com1.io_base == 0x3f8) {
-            /* Also init com2 for Tiger4. */
-            ns16550_com2.io_base = 0x2f8;
-            ns16550_com2.irq     = 3;
-            ns16550_init(1, &ns16550_com2);
-        }
+        ns16550_init(1, &ns16550_com2);
     }
     serial_init_preirq();